package com.diandi.messages.utils.http;





import com.diandi.messages.enums.ReturnCode;
import com.diandi.messages.tools.Tools;

import java.util.HashMap;
import java.util.Map;

/**
 * 校验业务端入参
 * Created by Administrator on 2017/6/29.
 */
public class CheckParams {



    /**
     * 判断业务平台必输入参是否存在
     *
     * @param params  参数集合
     * @param strings 需要校验的key
     * @return
     */
    public static Map<String, String> checkParamsIsExist(Map<String, String> params, String... strings) {
        Map<String, String> returnMap = new HashMap<String, String>();
        for (String string : strings) {
            if (!params.containsKey(string) || params.get(string).isEmpty()) {
                returnMap = Tools.createReturnParams(ReturnCode.err_1000, ReturnCode.err_1000.getMsg(), string);
                return returnMap;
            }
        }
        return returnMap;
    }


}
